<?php include_once("right_head.php") ?>
<div class="common">
    <div class="goodsTitle">
        <a href="<?php echo base_url(); ?>admin/categoryaction/addCat/<?php echo $type ?>" class="topBtn">添加分类</a>
    </div>
    <table class="listTab" cellpadding="0" cellspacing="0" bordercolor="#e4e4e4" border="1">
        <tr height="39" style="font-size:13px;">
            <td style="width: 5%">分类编号</td>
            <td style="width: 35%;">分类名称</td>
            <td style="width: 5%">排序</td>
            <td style="width: 5%">是否显示</td>
            <td style="width: 25%">操作</td>
        </tr>
        <?php
        if (!empty($categoryList)) {
            foreach ($categoryList as $key => $value) {
                ?>
                <tr height="30">
                    <td>[<?php echo($key + 1); ?>]</td>
                    <td style="text-align: left;padding:0 0 0 10px;"><?php echo $value->cat_name ?></td>
                    <td>
                <?php
                if(strlen($value->cat_real_id) > 11){//排除一级分类
                    ?>
                        <input style="width: 40px;height:25px;" name="sort" id="sort"
                               onchange="changeClassSort(<?php echo $value->cat_id ?>,$(this).val(),'<?php echo base_url() ?>')"
                               value="<?php echo $value->sort ?>" class="normalText"/>
                    <?php }?>
                    </td>
                    <td style="text-align: left;padding:0 0 0 10px;">
                        <?php
                            if(strlen($value->cat_real_id) > 11){//排除一级分类
                                echo ($value->is_show)?
                                '<a href="javascript:;" onclick="changeType(\''.base_url().'\',this,\'is_show\',0,'.$value->cat_id.',\'category\',\'cat_id\')"><img src="'.base_url('assets/admin/image/yes.gif').'"></a>'
                                :
                                '<a href="javascript:;" onclick="changeType(\''.base_url().'\',this,\'is_show\',1,'.$value->cat_id.',\'category\',\'cat_id\')"><img src="'.base_url('assets/admin/image/no.gif').'"></a>';
                            }
                        ?>
                    </td>
                    <td>
                        <?php if(strlen($value->cat_real_id) > 5){//排除一级分类 ?>
                            <a href="<?php echo base_url(); ?>admin/categoryaction/addCat/<?php echo $type ?>/<?php echo $value->cat_id ?>">添加子分类</a>
                            <span class="caozuo_line">|</span>
                            <a href="<?php echo base_url(); ?>admin/categoryaction/editCat/<?php echo $type ?>/<?php echo $value->cat_id ?>">编辑分类</a>
                            <span class="caozuo_line">|</span>
                            <a onclick="javascript:if(confirm('确认删除？')){deleteClass($(this),<?php echo $value->cat_id ?>,'<?php echo base_url() ?>');}">删除分类</a>
                            <?php
                            if (($type == 2 or $type == 4) && strlen($value->cat_real_id) > 11) {
                                ?>
                                <span class="caozuo_line">|</span>
                                <a href="<?php echo base_url(); ?>index.php/categoryaction/editClassYproperty/<?php echo $value->cat_id ?>/<?php echo $type ?>">编辑属性</a>
                            <?php }
                        }else{ /*?>
                            <a onclick="javascript:if(confirm('确认删除？')){deleteClass($(this),<?php echo $value->cat_id ?>,'<?php echo base_url() ?>');}">删除分类</a>
                        <?php */}?>
                    </td>
                </tr>
            <?php }
        } ?>
    </table>

</div>
<?php include_once(VIEWPATH."admin/publish/main_footer.php");?>
</body>
</html>